#include<cstdio>

int a[1000] = {0};
int d[1000] = {0};

int main()
{
	
	freopen("zz_test\\test1.in", "r", stdin);
	freopen("zz_test\\test1.out", "w", stdout);
	
	int n = 0;
	scanf("%d", &n);
	for ( int i = 0; i < n; i++ ) {
		scanf("%d", &a[i]);
	}
	
	d[0] = 1;
	int maxLen = 1;
	for ( int i = 1; i < n; i++ )
	{
		int max = 0;
		for ( int j = 0; j < i; j++ ) {
			if ( a[j] < a[i] && d[j] > max ) {
				max = d[j];
			}
		}
		d[i] = max + 1;
		if ( maxLen < d[i] ) {
			maxLen = d[i];
		}
	}
	printf("%d", maxLen);
	return 0;
}


